#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
#include<vector>
#include<unordered_map>

using namespace std;

int countWords(vector<string>& words1, vector<string>& words2) {
    unordered_map<string, int> um1;
    unordered_map<string, int> um2;
    for (auto s : words1)
        um1[s]++;
    for (auto s : words2)
        um2[s]++;

    int res = 0;
    for (auto it : um1)
        if (it.second == 1 && um2.count(it.first))
            if (um2[it.first] == 1)
                res++;
    return res;
}